import {customeStruct} from '../utils';
const itf = customeStruct.interface;

const defaultProps = {
    id: 'string',
    code: 'string',
    name: 'string',
    shortCode: 'string? | null',
    shortName: 'string? | null',
    country: 'string? | null',
    province: 'string? | null',
    city: 'string? | null',
    contactNumber: 'string? | null',
    address: 'string? | null',
    kind: 'number? | null',
};

export const init = itf({
    payload: itf({
        isDealerUser: 'boolean',
        currentCompany: itf({
            id: 'string',
            code: 'string',
            name: 'string'
        }),
        brands: [itf({
            brandId: 'string',
            brandCode: 'string',
            brandName: 'string'
        })],
        tradeMethods: [itf({
            tradeMethodId: 'string',
            tradeMethodCode: 'string',
            tradeMethodName: 'string'
        })],
    })
});

export const list = itf({
    payload: itf({
        content: [itf(Object.assign({
            options: ['string']
        }, defaultProps))],
        totalElements: 'number',
    })
});

export const detail = itf({
    payload: itf(Object.assign({
        fax: 'string? | null',
        zipCode: 'string? | null',
        rowVersion: 'string? | null',
        dealerParts: [itf({
            id: 'string',
            brandId: 'string',
            brandCode: 'string',
            brandName: 'string',
            tradeMethodId: 'string',
            tradeMethodCode: 'string',
            tradeMethodName: 'string',
            arrivedDealerId: 'string',
            arrivedDealerCode: 'string',
            arrivedDealerName: 'string',
            priceClause: 'number? | null',
            isSeparate: 'boolean? | null',
            isPlaned: 'boolean? | null',
            currency: 'number? | null',
            labelRequirement: 'string? | null',
            palletizing: 'number? | null',
            shippingMark: 'string? | null',
            isClaim: 'boolean',
        })],
        dealerBanks: [itf({
            bankId: 'string',
            bankCode: 'string',
            bankName: 'string'
        })],
        parts: [itf({
            partId: 'string',
            partCode: 'string',
            partName: 'string'
        })],
        orderingCalendars: [itf({
            partSaleOrderTypeId: 'string? | null',
            partSaleOrderTypeCode: 'string? | null',
            partSaleOrderTypeName: 'string? | null',
            calendar: [itf({
                year: 'number',
                month: 'number',
                day: 'number',
            })]
        })],
        options: ['string']
    }, defaultProps))
});

export const dealerSelectList = itf({
    payload: itf({
        content: [itf({
            id: 'string',
            code: 'string',
            name: 'string',
            shortCode: 'string? | null',
            shortName: 'string? | null',
            countryName: 'string? | null',
            provinceName: 'string? | null',
            cityName: 'string? | null',
            contactPhone: 'string? | null',
            address: 'string? | null',
        })],
    })
});

export const marketDepartmentList = itf({
    payload: [itf({
        id: 'string',
        code: 'string',
        name: 'string',
        isLeaf: 'boolean',
    })]
});

export const regionList = itf({
    payload: itf({
        content: [itf({
            id: 'string',
            name: 'string',
        })],
    })
});

export const bank = itf({
    payload: itf({
        content: [itf({
            id: 'string',
            code: 'string',
            name: 'string',
        })],
    })
});

export const part = itf({
    payload: itf({
        content: [itf({
            id: 'string',
            code: 'string',
            name: 'string',
        })],
    })
});


